package File;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo2 {
    public static void main(String[] args) throws IOException {
//        InputStream inputStream = null;
//
//        try {
//            inputStream = new FileInputStream("./test.txt");
//        } finally {
//            inputStream.close();
//        }

        try (InputStream inputStream = new FileInputStream("./test.txt")) {
            while (true) {
                int ret = inputStream.read();
                if (ret == -1) {
                    break;
                }
                System.out.printf("0x%d\n", ret);
            }
        }//直接close
    }
}
